#ifndef ADAPTIVEWIDGETS_H
#define ADAPTIVEWIDGETS_H

#include <QWidget>
#include <QDialog>
#include <QMainWindow>
#include <QTabWidget>
#include <QScrollArea>
#include <QGroupBox>
#include <QPushButton>
#include <QComboBox>
#include <QCheckBox>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QLabel>
#include <QSlider>
#include <QMessageBox>
#include <QGridLayout>
#include <QLineEdit>
#include <QFrame>
#include <QDebug>


#include "adaptivewidget.h"


class AWidget : public AdaptiveWidget<QWidget>
{
    Q_OBJECT
public:
    explicit AWidget(QWidget *parent = nullptr);
};

class ADialog : public AdaptiveWidget<QDialog>
{
    Q_OBJECT
public:
    explicit ADialog(QWidget *parent = nullptr);
};

class AMainWindow : public AdaptiveWidget<QMainWindow>
{
    Q_OBJECT
public:
    explicit AMainWindow(QWidget *parent = nullptr);
};

class AScrollArea : public AdaptiveWidget<QScrollArea>
{
    Q_OBJECT
public:
    explicit AScrollArea(QWidget *parent = nullptr);
};

class ATabWidget : public AdaptiveWidget<QTabWidget>
{
    Q_OBJECT
public:
    explicit ATabWidget(QWidget *parent = nullptr);
    using QTabWidget::addTab;
    int addTab(QWidget *widget, const QString &title);
};

class AGroupBox : public AdaptiveWidget<QGroupBox>
{
    Q_OBJECT
public:
    explicit AGroupBox(QWidget *parent = nullptr);
    explicit AGroupBox(const QString &title, QWidget *parent = nullptr);
    using QGroupBox::setTitle;
    void setTitle(const QString &title);
};

class ACheckBox : public AdaptiveWidget<QCheckBox>
{
    Q_OBJECT
public:
    explicit ACheckBox(QWidget *parent = nullptr);
    explicit ACheckBox(const QString &text, QWidget *parent = nullptr);
};

class AComboBox : public AdaptiveWidget<QComboBox>
{
    Q_OBJECT
public:
    explicit AComboBox(QWidget *parent = nullptr);
    using QComboBox::addItem;
    using QComboBox::addItems;
    void addItem(const QString &text, const QVariant &userData = QVariant());
    void addItems(const QStringList &texts);
};

class ASpinBox : public AdaptiveWidget<QSpinBox>
{
    Q_OBJECT
public:
    explicit ASpinBox(QWidget *parent = nullptr);
};

class ADoubleSpinBox : public AdaptiveWidget<QDoubleSpinBox>
{
    Q_OBJECT
public:
    explicit ADoubleSpinBox(QWidget *parent = nullptr);
};

class ASlider : public AdaptiveWidget<QSlider>
{
    Q_OBJECT
public:
    explicit ASlider(QWidget *parent = nullptr);
};

class ALabel : public AdaptiveWidget<QLabel>
{
    Q_OBJECT
public:
    explicit ALabel(QWidget *parent = nullptr);
    explicit ALabel(const QString &text, QWidget *parent = nullptr);
    using QLabel::setText;
    void setText(const QString &text);
};

class APushButton : public AdaptiveWidget<QPushButton>
{
    Q_OBJECT
public:
    explicit APushButton(QWidget *parent = nullptr);
    explicit APushButton(const QString &text, QWidget *parent = nullptr);
    using QPushButton::setText;
    void setText(const QString &text);
};

class ALineEdit : public AdaptiveWidget<QLineEdit>
{
    Q_OBJECT
public:
    explicit ALineEdit(QWidget *parent = nullptr);
    explicit ALineEdit(const QString &contents, QWidget *parent = nullptr);
    void setText(const QString &text);
signals:
    void textConfirmed(const QString &text);
protected:
    void focusOutEvent(QFocusEvent *e) override;
    void keyPressEvent(QKeyEvent *e) override;
private slots:
    void onEditFinished();
private:
    QString m_lastConfirmedText;
};

class AHLine : public QFrame
{
    Q_OBJECT
public:
    explicit AHLine(QWidget *parent = nullptr);
};

class AVLine : public QFrame
{
    Q_OBJECT
public:
    explicit AVLine(QWidget *parent = nullptr);
};

#endif // ADAPTIVEWIDGETS_H
